<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:easy="http://easy.widgets.com"
    template="/basic.xhtml">


<ui:define  name="body">
    
    <a4j:form id="form">
    <a4j:keepAlive beanName="clienteManagedBean" />
        
        <rich:simpleTogglePanel switchType="client" label="#{rotulo['cadastro_clientes']}" id="dadosBasicos">
        
            <h:selectOneRadio value="#{clienteManagedBean.tipoDePessoaSelecionado}" >
                <f:selectItems value="#{clienteManagedBean.tiposDePessoas.opcoes}"/>
                <a4j:support action="#{clienteManagedBean.controlaTipoPessoa}"
                event="onclick" reRender="form"/>
            </h:selectOneRadio>

            <a4j:region  rendered="#{clienteManagedBean.renderedCamposPessoaFisica}">
                <easy:inputCamposPessoaFisica cliente="#{clienteManagedBean.cliente}"
                sexo="#{clienteManagedBean.sexo}" estadoCivil="#{clienteManagedBean.estadoCivil}"/>
            </a4j:region>

            <a4j:region  rendered="#{clienteManagedBean.renderedCamposPessoaJuridica}">
                <easy:inputCamposPessoaJuridica cliente="#{clienteManagedBean.cliente}"/>
            </a4j:region>

        </rich:simpleTogglePanel>

        <a4j:region rendered="#{clienteManagedBean.renderedInclusaoEndereco}">
            <ui:include src="include/endereco.xhtml"/>
        </a4j:region>

        <a4j:region rendered="#{clienteManagedBean.renderedInclusaoEndereco}">
            <ui:include src="include/telefone.xhtml"/>
        </a4j:region>

        <a4j:region rendered="#{clienteManagedBean.renderedInclusaoEndereco}">
            <ui:include src="include/email.xhtml"/>
        </a4j:region>

        <a4j:region rendered="#{clienteManagedBean.renderedInclusaoEndereco}">
            <ui:include src="include/site.xhtml"/>
        </a4j:region>


         <ui:include src="include/contato.xhtml"/>

    </a4j:form>
</ui:define>

</ui:composition>
